#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTcpSocket>
#include "qcustomplot.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    //方法
    void TcpInit();
    void onReadMessage();
    void onDisplayError(QAbstractSocket::SocketError e);
    void ShowData(QByteArray);
    void initChart();
    //变量
    QTcpSocket *tcpSocket;
    bool isconnect;
    //绘图变量
    QCPGraph *graph1;
    QCPGraph *graph2;
    QCPGraph *graph3;
    QCPGraph *graph4;
    QCPGraph *graph5;

    //绘图数据容器
    QVector<double>x_temp;
    QVector<double>y_temp;
    QVector<double>x_humi;
    QVector<double>y_humi;
    QVector<double>x_Light;
    QVector<double>y_Light;
    QVector<double>x_Weight;
    QVector<double>y_Weight;
    QVector<double>x_Water;
    QVector<double>y_Water;

    //绘图函数
    void Point_temp( double);
    void Point_humi( double);
    void Point_Light( double);
    void Point_Weight( double);
    void Point_Water( double);

    //绘图阈值
    int size_temp;
    int size_humi;
    int size_Light;
    int size_Weight;
    int size_Water;
private slots:
    void on_pushButton_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

private:
    Ui::MainWindow *ui;

    QString pass;
};
#endif // MAINWINDOW_H
